package com.briup.oagg.facade.web.controller.model;

import com.briup.framework.utils.web.Response;
import com.briup.oagg.facade.service.model.IClassificationTrainResultService;
import com.briup.oagg.facade.web.vm.model.ClassificationTrainResultVM;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 分类训练评估结果信息前端控制器
 *
 * @author briup
 */
@Api(tags ="2.6.分类训练评估结果管理服务")
@RestController
@RequestMapping("/classificationTrainResult")
public class ClassificationTrainResultController {
    @Autowired
    private IClassificationTrainResultService service;

    @ApiOperation("根据训练编号查询分类模型训练评估结果")
    @ApiImplicitParam(name = "trainId",value = "训练编号",dataTypeClass = String.class,paramType = "path")
    @GetMapping("/{trainId}")
    public Response<ClassificationTrainResultVM> findByTrainId(@PathVariable String trainId){
        ClassificationTrainResultVM result = service.findByTrainId(trainId);
        return Response.success(result);
    }

    @ApiOperation("根据模型编号查询分类模型训练评估结果")
    @GetMapping("/model")
    public Response<List<ClassificationTrainResultVM>> findByModelId(String modelId){
        List<ClassificationTrainResultVM> list = service.findByModelId(modelId);
        return Response.success(list);
    }

}
